package com.example.test_anno_and_aspect.controller;

import com.example.test_anno_and_aspect.anno.AnnoDemo;
import com.example.test_anno_and_aspect.dto.TestDto;
import org.springframework.web.bind.annotation.*;

/**
 * @version 1.0.0
 * Created by cyd on 2022-05-31 10:33:57
 */
@RestController
@RequestMapping("/test")
public class TestController {

    @GetMapping("/testGet")
    public String testGet(@RequestParam String name,
                          @RequestParam(required = false) Long age) {
        return "successGet";
    }

    @GetMapping("/testGetWithAnno")
    @AnnoDemo(requestType = AnnoDemo.RequestType.GET)
    public String testGetWithAnno(@RequestParam String name,
                                  @RequestParam(required = false) Long age) {
        return "successGet";
    }

    @PostMapping("/testPostWithAnno")
    @AnnoDemo(requestType = AnnoDemo.RequestType.POST)
    public String testPostWithAnno(@RequestBody TestDto dto) {

        return "successPost";
    }
}
